'\"macro stdmacro
.\"
.\" Copyright (c) 2016,2018 Red Hat.
.\"
.\" This program is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by the
.\" Free Software Foundation; either version 2 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but
.\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
.\" for more details.
.\"
.\"
.TH PMSEMSTR 3 "PCP" "Performance Co-Pilot"
.SH NAME
\f3pmSemStr\f1,
\f3pmSemStr_r\f1 \- convert a performance metric semantic into a string
.SH "C SYNOPSIS"
.ft 3
.ad l
.hy 0
#include <pcp/pmapi.h>
.sp
const char *pmSemStr(int \fIsem\fP);
.br
char *pmSemStr_r(int \fIsem\fP, char *\fIbuf\fP, int \fIbuflen\fP);
.sp
cc ... \-lpcp
.hy
.ad
.ft 1
.SH DESCRIPTION
.de CR
.ie t \f(CR\\$1\f1\\$2
.el \fI\\$1\f1\\$2
..
Given a performance metric
.IR semantic ,
.B pmSemStr
produces a terse ASCII equivalent, appropriate for use in error and diagnostic
messages.
The
.B pmSemStr_r
function does the same, but stores the result in a user-supplied buffer
.I buf
of length
.IR buflen ,
which should have room for at least 20 bytes.
.PP
The value for
.I sem
is typically extracted from a
.CR pmDesc
structure, following a call to
.BR pmLookupDesc (3)
for a particular performance metric.
.PP
Examples are
.B counter
(for
.I sem
equals
.BR PM_SEM_COUNTER ),
.B discrete
(for
.I sem
equals
.BR PM_SEM_DISCRETE ),
.B instant
(for
.I sem
equals
.BR PM_SEM_INSTANT ),
etc.
.SH NOTES
Both of these routines are safe to call from threaded applications.
.SH SEE ALSO
.BR PMAPI (3),
.BR pmAtomStr (3),
.BR pmConvScale (3),
.BR pmExtractValue (3),
.BR pmLookupDesc (3),
.BR pmPrintValue (3),
.BR pmIDStr (3),
.BR pmInDomStr (3),
.BR pmTypeStr (3)
and
.BR pmUnitsStr (3).
